package com.dao.impl;

import java.util.List;

import org.apache.log4j.Logger;
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.SessionFactoryUtils;
import org.springframework.stereotype.Repository;

import com.bean.Disco;
import com.dao.RegistroDao;

@Repository ("DiscoDaoImpl")
public class DiscoDaoImpl implements RegistroDao {
	Logger log	= Logger.getLogger(DiscoDaoImpl.class);
	
	@Autowired
	private SessionFactory	sessionFactory;
	
	@Override
	public boolean agregaRegistro(Object registro) {
		log.debug("begin");
		log.debug("finally");
		return false;
	}

	@Override
	public boolean eliminaRegistro(Object registro) {
		log.debug("begin");
		log.debug("finally");
		return false;
	}

	@Override
	public void modificaRegistro(Object registro) {
		log.debug("begin");
		log.debug("finally");

	}

	@Override
	public Object buscaRegistroPorParametro(String param, Object registro) {
		log.debug("begin");
		log.debug("finally");
		return null;
	}

	
	@SuppressWarnings("unchecked")
	@Override
	public <T> List<T> listaDeRegistros() {
		log.debug("begin");
		Session session		= SessionFactoryUtils.getSession(sessionFactory, true);
		Criteria criterio	= session.createCriteria(Disco.class);
		log.debug("finally");
		return criterio.list();
	}

}
